<?php
namespace Company\Controller;
use Think\Controller;
class TestController extends BaseController {
	public function _initialize()
    {
        parent::_initialize();
        $g=session('company');
		C('erp_dbname',$g['db']);
        $db_name=$g['db'];
		//数据库连接基础配置-begin
		C('db_config.DB_TYPE',C('DB_TYPE'));
		C('db_config.DB_HOST',C('DB_HOST'));
		C('db_config.DB_USER',C('DB_USER'));
		C('db_config.DB_PWD',C('DB_PWD'));
		C('db_config.DB_PORT',C('DB_PORT'));
		C('db_config.DB_CHARSET',C('DB_CHARSET'));
		C('db_config.DB_NAME',C('erp_dbname'));
		//数据库连接基础配置-end
        
    }
	
	public function tax(){
		$arr=[];
		$a1['total_price']=23.0000*1;
		$a1['consumption_rate']=0;//消费税率
		$a1['increment_rate']=0.16;//增值税率
		
		
		$a2['total_price']=13.50*5;
		$a2['consumption_rate']=0.15;//消费税率
		$a2['increment_rate']=0.16;//增值税率
		
		$a3['total_price']=6.2000*20;
		$a3['consumption_rate']=0;//消费税率
		$a3['increment_rate']=0.16;//增值税率
		
		$arr[]=$a1;
		$arr[]=$a2;
		$arr[]=$a3;
		// echo "<pre>";
		// var_dump($arr);
		// die;
		
		$ems_fee=0;//运费
		$insure_amount=0;//保费
		
		$total_fee=0;
		foreach($arr as $k=>$v){
			$thefee= total_tax($v['total_price'],$ems_fee,$insure_amount,$v['consumption_rate'],$v['increment_rate'],0.7);
			$total_fee +=$thefee;
			echo $thefee;
			echo "<br>";
		}
		echo $total_fee;
	}

	
}